package cn.pugle.oj.leetcode;

import cn.pugle.oj.catalog.WC;

/**
 * @author tzp
 * @since 2020/9/27
 */
public class WC208_1 implements WC {
    public int minOperations(String[] logs) {
        if (logs == null || logs.length == 0) return 0;
        int level = 0;
        for (int i = 0; i < logs.length; i++) {
            switch (logs[i]) {
                case "../": {
                    if (level != 0) {
                        level--;
                    }
                    break;
                }
                case "./": {
                    break;
                }
                default: {
                    level++;
                    break;
                }
            }
        }
        return level;
    }

    public static void main(String[] args) {
//        String[] a = {"d1/", "d2/", "../", "d21/", "./"};
//        String[] a = {"d1/","d2/","./","d3/","../","d31/"};
        String[] a = {"d1/", "../", "../", "../"};
        System.out.println(new WC208_1().minOperations(a));
    }
}
